﻿using System;
using System.Windows;
using AutoLoL.Entities;
using AutoLoL.Logic.Windows;
using AutoLoL.Shared;
using Point = System.Drawing.Point;

namespace AutoLoL.Logic
{
    public class PointLocator
    {
        public static double MapH(Rect windowRect, double baseX)
        {
            return (baseX / Constants.BASE_CLIENT_WIDTH) * windowRect.Width;
        }

        public static double MapV(Rect windowRect, double baseY)
        {
            return (baseY / Constants.BASE_CLIENT_HEIGHT) * windowRect.Height;
        }

        public static Point GetUsernameBox(ClientWindow clientWindow, bool offset = true)
        {
            Rect windowRect = clientWindow.ClientRectangle;

            double x = MapH(windowRect, 990);
            double y = MapV(windowRect, 323);

            Point result = new Point((int)x, (int)y);

            if (offset)
            {
                result.Offset(clientWindow.Position);
            }

            return result;
        }
    }
}
